﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Mongaba.Core.Util;
using Mongaba.Core;

namespace Mongaba
{
    public partial class frmDebug : Form
    {
        public frmDebug()
        {
            InitializeComponent();
            outputWriter = new TextBoxStreamWriter(txtDebug);
            outputWriter.AutoScroll = mbpAutoScroll.Checked;
            outputWriter.PauseDebug = mbpPauseDebug.Checked;
            this.Icon = Properties.Resources.Mongaba;
            

        }

        public void WriteLine(string text)
        {
            outputWriter.WriteLine(text);
        }
      
        private void mpbAbout_Click(object sender, EventArgs e)
        {
            new frmAboutBox().Show();
        }

        private void frmDebug_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                e.Cancel = true;
                this.Hide();
            }
        }

        private void mbpExit_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        TextBoxStreamWriter outputWriter = null;

        public TextBoxStreamWriter OutputWriter
        {
            get { return outputWriter; }
            set { outputWriter = value; }
        }

        private void mbpAutoScroll_CheckedChanged(object sender, EventArgs e)
        {
            OutputWriter.AutoScroll = mbpAutoScroll.Checked;
        }

        private void mbpPauseDebug_CheckedChanged(object sender, EventArgs e)
        {
            OutputWriter.PauseDebug = mbpPauseDebug.Checked;
        }

        private void mbpClear_Click(object sender, EventArgs e)
        {
            OutputWriter.Clear();
        }

        private void frmDebug_Shown(object sender, EventArgs e)
        {
            lblAdress.Text = Utilities.HostIp.ToString();
        }

                 
    }
}
